package task;

public class Task3_9 {
    public static void main(String[] args) {
        double sum = 0.0;
        int flg = 1;
        for (double i = 1.0; i <= 100; i++) {

            sum +=  (1.0 / i) *flg;
            flg = - flg;

        }
        System.out.println("1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100的值为：" + sum);
    }
}
